package com.example.demospringboot.flow.exec;

import lombok.Setter;
import org.flowable.bpmn.model.FlowElement;
import org.flowable.common.engine.api.delegate.Expression;
import org.flowable.engine.delegate.DelegateExecution;
import org.flowable.engine.delegate.ExecutionListener;

/**
 * 执行监听器
 *   需要实现 ExecutionListener 接口
 */
public class ExecutionListener1 implements ExecutionListener {

    @Setter
    private Expression msg1;
    @Setter
    private Expression msg2;

    @Override
    public void notify(DelegateExecution execution) {
        System.out.println("------ExecutionListener1  开始-------------");
        FlowElement currentFlowElement = execution.getCurrentFlowElement();
        System.out.println("currentFlowElement.getName() = " + currentFlowElement.getName());
        String currentActivityId = execution.getCurrentActivityId();
        System.out.println("currentActivityId = " + currentActivityId);
        String eventName = execution.getEventName();
        System.out.println("eventName = " + eventName);
        // System.out.println(msg1.getValue(execution));
        // System.out.println(msg2.getValue(execution));
        System.out.println("------ExecutionListener1  结束-------------");
    }
}